<div class="row-fluid">
    <div class="box paint color_11">
        <div class="title">
            <h4> <span><?php echo __('Choices'); ?></span> </h4>
        </div>
        <!-- End .title -->

        <div class="content top">
<?php

if(isset($teachers))
{
	foreach ($teachers as $key => $teacher):
?>
<div class="row-fluid">
	<div class="span12" style="text-align: left;">
		<blockquote style="border-bottom: 1px solid #f5f5f5;">
			<p><h5 style="font-size: 36px;"><?php echo $teacher['Teacher']['name'] ?></h5></p>
		</blockquote>
	</div>
</div>
    <table  class="responsive table table-striped table-bordered" style="margin-bottom: 30px;">
        <thead>
            <tr>
                <th><?php echo __('Semester') ?></th>
                <th><?php echo __('Discipline') ?></th>
                <th><?php echo __('W. Sem.') ?></th>
                <th><?php echo __('W. Theoric') ?></th>
                <th><?php echo __('W. Practice') ?></th>
                <th><?php echo __('Team') ?></th>
                <th><?php echo __('Course') ?></th>
                <th><?php echo __('Weight') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($disciplines as $key => $discipline): ?>
            <?php if(isset($choices[$teacher['Teacher']['id']][$discipline['Discipline']['id']])): ?>
                <tr>
                    <td rel="semester"><?php echo $discipline['Discipline']['semester'] ?>&nbsp;</td>
                    <td><a data-toggle="modal" href="#<?php echo $discipline['Discipline']['id'] ?>" style="color:#ffffff; text-decoration: underline"><?php echo $discipline['Team']['name'] ?></a>&nbsp;</td>
                    <td><?php echo $discipline['Discipline']['total_workload'] ?>&nbsp;</td>
                    <td><?php echo $discipline['Discipline']['theoretical_workload'] ?>&nbsp;</td>
                    <td><?php echo $discipline['Discipline']['practice_workload'] ?>&nbsp;</td>
                    <td><?php echo $discipline['Discipline']['team'] ?>&nbsp;</td>
                    <?php $courses = array(); ?>
                    <?php foreach ($discipline['Courses'] as $course) : 
                        $courses[] = $course['acronym'];
                    endforeach; ?>
                    <td><?php echo implode(" + ", $courses) ?>&nbsp;</td>
                    <td rel="weight"><?php echo $choices[$teacher['Teacher']['id']][$discipline['Discipline']['id']] ?>&nbsp;</td>
                </tr>
            <?php endif; ?>
        <?php endforeach; ?>
        </tbody>
    </table>

<?php
	endforeach;
}
?>
        </div>
        <!-- End .content --> 
    </div>
    <!-- End box --> 
</div>
<!-- End .row-fluid -->
<?php foreach ($disciplines as $key => $discipline): ?>
  <div id="<?php echo $discipline['Discipline']['id'] ?>" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-header">
      <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
      <h3 id="myModalLabel">Documentos</h3>
    </div>
    <div class="modal-body">
      <p><?php echo $this->Upload->view('Team', $discipline['Team']['id'], false, true); ?></p>
    </div>
    <div class="modal-footer">
      <button class="btn" data-dismiss="modal">Fechar</button>
    </div>
  </div>
<?php endforeach; ?>